<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
      layout:decorate="~{admin/layout}">
<body>
<div  class="content-wrap" layout:fragment="content">
    <main id="content"  class="content" role="main">
        <ol class="breadcrumb">
            <li>财务管理</li>
            <li class="active">成本管理</li>
        </ol>
        <div>
            <section class="widget">
                <header>
                    <button class="btn btn-gray" data-toggle="modal" data-target="#myModal18">
                        成本录入
                    </button>
                    <div class="layui-inline">
                        <label class="layui-form-label">日期范围</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="test6"  lay-key="7">
                            <button  onclick="select()">查询</button>
                        </div>
                    </div>
                    <script>
                        function select() {
                            self.location.href = "/admin/finance/datecost?date=" + $("#test6").val();
                        }
                        layui.use('laydate', function(){
                            var laydate = layui.laydate;
                            //执行一个laydate实例
                            laydate.render({
                               elem: '#test6',
                                range: true   //指定元素
                            });
                        });
                    </script>
                </header>
                <div class="widget-body">
                    <table class="table table-striped table-hover dataTable no-footer" >
                        <thead>
                        <tr>
                            <th>水电杂费</th>
                            <th>农药</th>
                            <th>化肥</th>
                            <th>地租</th>
                            <th>人工费</th>
                            <th>其他</th>
                            <th>录入时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="cost:${cost}">
                            <td th:text="${cost.waterrate}"></td>
                            <td th:text="${cost.medicine}"></td>
                            <td th:text="${cost.chemical}"></td>
                            <td th:text="${cost.landrent}"></td>
                            <td th:text="${cost.personrate}"></td>
                            <td th:text="${cost.rests}"></td>
                            <td th:text="*{#dates.format(cost.enteringTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                        </tr>
                        </tbody>
                    </table>

                    <div class="modal fade" id="myModal18" tabindex="-1" role="dialog" aria-labelledby="myModalLabel18" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                    <h5 class="modal-title text-xl-center fw-bold mt" id="myModalLabel18">成本录入</h5>
                                </div>
                                <div class="modal-body bg-gray-lighter">
                                    <form th:action="@{/admin/finance/save/cost}" class="form-horizontal form-label-left" method="post">
                                        <span class="label label-warning  text-gray-dark mr-xs"></span>
                                        <fieldset>
                                            <legend>
                                            </legend>
                                            <div class="form-group row">
                                                <label class="control-label col-sm-3" for="basic-change">
                                                    化肥
                                                    <span class="help-block"></span>
                                                </label>
                                                <div class="col-sm-9">
                                                    <input type="text"  name="chemical" class="form-control" required="required"  onkeyup="value=value.replace(/[^\d.]/g,'')">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-sm-3" for="basic-change">
                                                    农药
                                                    <span class="help-block"></span>
                                                </label>
                                                <div class="col-sm-9">
                                                    <input type="text" id="basic-change" name="medicine" class="form-control" required="required"  onkeyup="value=value.replace(/[^\d.]/g,'')">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-sm-3" for="email" required="required">
                                                    地租
                                                </label>
                                                <div class="col-sm-9">
                                                    <input type="text" id="email" name="landrent" class="form-control" required="required"  onkeyup="value=value.replace(/[^\d.]/g,'')">
                                                    <span class="help-block"> </span>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-sm-3" for="number">
                                                    人工费
                                                </label>
                                                <div class="col-sm-9">
                                                    <input type="text" id="number" name="personrate" class="form-control" required="required"   onkeyup="value=value.replace(/[^\d.]/g,'')">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="control-label col-sm-3" for="basic">水、电、杂费</label>
                                                <div class="col-sm-9">
                                                    <input type="text" id="basic" name="waterrate" class="form-control" required="required"  onkeyup="value=value.replace(/[^\d.]/g,'')">
                                                </div>
                                            </div>
                                            <button type="submit" class="btn btn-danger btn-rounded pull-xs-right">提交</button>
                                        </fieldset>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </main>
</div>
</body>
</html>